/*
 * @Author: xiaosihan 
 * @Date: 2024-08-14 18:09:29 
 * @Last Modified by: xiaosihan
 * @Last Modified time: 2025-10-02 13:35:59
 */
import Api from "./Api";
//接口模版
class TinypngApi extends Api {

    constructor() {
        super();
    }
    //ping
    ping() {
        return this._get("/ping");
    }
    //分页获取key
    get_key_list(page: number = 1, pageSize: number = 10) {
        return this._get("/get_key_list", { page, pageSize });
    }
    //添加key
    add_key(key: string, page: number = 1, pageSize: number = 10) {
        return this._post("add_key", { key, page, pageSize });
    }
    //删除key
    del_key(key: string) {
        return this._get("del_key", { key });
    }
    // 更具需要转换的数量获取key
    get_key_by_conut(conut: number = 1) {
        return this._get("get_key_by_conut", { conut });
    }
    // 校验所有的key
    validate_all_key() {
        return this._get("validate_all_key");
    }

    // 更新余额和已用数量
    update_residue(key: string, compressionCount: number, residue: number) {
        return this._post("update_residue", { key, compressionCount, residue });
    }

    // 获取接口响应测试数据
    get_api_response_test() {
        return this._get("get_api_response_test");
    }

    // 保存接口响应测试数据
    save_api_response_test(interval_time: number, response_time: number) {
        return this._post("save_api_response_test", { interval_time, response_time });
    }

    // 清空所有接口响应测试数据
    clear_api_response_test() {
        return this._get("clear_api_response_test");
    }

}
const tinypngApi = new TinypngApi();
export default tinypngApi;